Package-level declarations

Inherited functions

Link copied to clipboard
@JvmName(name = "countMatchingFull")
fun CharSequence.countMatching(vararg chars: Char): Int

Counts continuous characters in this string that are present in the chars array.

fun CharSequence.countMatching(range: IntRange, vararg chars: Char): Int

Counts continuous characters in this string that are present in the chars array. The count goes withing the given range, which is coerced to the string boundaries.

fun CharSequence.countMatching(start: Int = 0, end: Int = length, vararg chars: Char): Int

Counts continuous characters in this string that are present in the chars array. The count goes from start to end (exclusive), which cover the full string by default and coerce to its boundaries.

Link copied to clipboard
@JvmName(name = "countWhileFull")
inline fun CharSequence.countWhile(predicate: (Char) -> Boolean): Int

Counts continuous characters in this string that match the given predicate.

inline fun CharSequence.countWhile(range: IntRange, predicate: (Char) -> Boolean): Int

Counts continuous characters in this string that match the given predicate. The count goes withing the given range, which is coerced to the string boundaries.

inline fun CharSequence.countWhile(start: Int = 0, end: Int = length, predicate: (Char) -> Boolean): Int

Counts continuous characters in this string that match the given predicate. The count goes from start to end (exclusive), which cover the full string by default and coerce to its boundaries.

Link copied to clipboard
fun CharSequence.getOrDefault(index: Int, default: Char = ' '): Char

Gets the character at the given index, or returns the default value if it's out of bounds. The default is ' ' (single whitespace) when unspecified.

Link copied to clipboard

Checks if this character matches pattern [a-zA-Z].

Link copied to clipboard

Checks if this character matches pattern [a-zA-Z0-9].

Link copied to clipboard

Creates a view for this string with all characters in the reverse order. Any changes in the original string will be reflected in the view.